<?php
namespace app\api\controller\v1;
use app\api\model\Banner;
use app\api\validate\IDMustBePostiveINT;
use app\lib\exception\BannerMissException;


class BannerController
{

    public function getBanner($id){
        (new IDMustBePostiveINT())->goCheck();

       $banner=Banner::getBannerByID($id);
       //隐藏指定字段
       //$banner->hidden(['delete_time','update_time']);
       // $banner->visible(['url']);//只显示某个字段
        if(!$banner)
        {
            throw new BannerMissException();
        }
            return $banner;
    }

}

